﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TextAnalyzer
{
    internal enum SearchType
    {
        Postfix = 1,
        Label,
        Region,
        Category
    }

    internal class SearchTypeHelper
    {
        private static SearchType[] mTypes = new SearchType[] { SearchType.Postfix, SearchType.Label, SearchType.Region, SearchType.Category };
        public static SearchType[] Types
        {
            get { return mTypes; }
        }
        public static string ToString(SearchType enumType)
        {
            string _type = null;
            if (0 < enumType) _type = enumType.ToString();
            return _type;
        }
        public static SearchType FromString(string strType)
        {
            SearchType _type = 0;
            if (!string.IsNullOrEmpty(strType))
            {
                string _compensated = strType.Trim().ToLower();
                foreach (SearchType _element in mTypes)
                {
                    string _source = ToString(_element).ToLower();
                    if (_source == _compensated)
                    {
                        _type = _element;
                        break;
                    }
                }
            }
            return _type;
        }
    }
}
